window.onload = function (){
    // 排序按钮交互
    document.addEventListener('DOMContentLoaded', function() {
        const sortButtons = document.querySelectorAll('.sort-btn');

        sortButtons.forEach(button => {
            button.addEventListener('click', function() {
                // 移除所有按钮的active类
                sortButtons.forEach(btn => btn.classList.remove('active'));

                // 给当前点击的按钮添加active类
                this.classList.add('active');

                // 这里可以添加实际的排序逻辑
                console.log('按' + this.textContent + '排序');
            });
        });

        // 文章卡片悬停效果
        const articleCards = document.querySelectorAll('.compact-article-card');
        articleCards.forEach(card => {
            card.addEventListener('mouseenter', function() {
                this.style.transform = 'translateY(-5px)';
                this.style.boxShadow = '0 15px 30px rgba(0, 0, 0, 0.4)';
            });

            card.addEventListener('mouseleave', function() {
                this.style.transform = 'translateY(0)';
                this.style.boxShadow = '0 10px 25px rgba(0, 0, 0, 0.3)';
            });
        });
    });

};